package com.taskmanagement.mapper;

import com.taskmanagement.entity.Task;
import org.apache.ibatis.annotations.Mapper;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface TaskMapper {

    List<Task> findByUserId(BigInteger userId);

    Task findByIdAndUserId(BigInteger id, BigInteger userId);

    int insert(Task task);

    int update(Task task);

    int delete(BigInteger id, BigInteger userId);

    int updateStatus(BigInteger id, BigInteger userId, String status);

    List<Task> findByUserIdWithStepCounts(BigInteger userId);

    Task findByIdAndUserIdWithStepCounts(BigInteger id, BigInteger userId);

    /**
     * 根据用户ID和状态查找任务，并包含步骤计数
     * @param userId 用户ID
     * @param status 任务状态
     * @return 包含步骤计数的任务列表
     */
    List<Task> findByUserIdAndStatusWithStepCounts(BigInteger userId, String status);
}
